import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class enemigo here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Enemigo extends Actor
{
    /**
     * Act - do whatever the enemigo wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    
    private int numGolpes=3;
    int cont=0;
    
    public void act() 
    {
        int i;
        World w=(Stage)getWorld(); 
        
          movimiento();
        Actor ry =getOneIntersectingObject(ryu.class);
        if(ry!=null)
        {
          ryu ryu1 = (ryu) ry;
          if(ryu1.revidas() >0)           
            ryu1.bajavidas();           
        }
        
        Actor ryF =getOneIntersectingObject(ryuF.class);
        if(ryF!=null)
        {
          ryuF ryu1 = (ryuF) ryF;
          if(ryu1.revidas() >0)           
            ryu1.bajavidas();           
        }
    }    
    
    public void movimiento()
    {
        if(getX()<50)
              setLocation(1100,getY());
        else              
        setLocation(getX()-1,getY());
    }
    
    public int regresaDano()
    {
      return(numGolpes);
    }  
    
    public void dano()
    {
        numGolpes--;
    }
    
    public void PosGolpe()
    {
        setLocation(getX()+30,getY());
    }
    
    public void PosPatada()
    {
        setLocation(getX()+40,getY());
    }
}
